package org.pearl.mybatis.demo.dao;

import org.apache.ibatis.annotations.MapKey;
import org.apache.ibatis.annotations.Mapper;
import org.apache.ibatis.annotations.Param;
import org.apache.ibatis.annotations.Select;
import org.pearl.mybatis.demo.pojo.entity.Organization;
import org.pearl.mybatis.demo.pojo.entity.Role;
import org.pearl.mybatis.demo.pojo.entity.User;
import org.pearl.mybatis.demo.pojo.po.UserInfoPo;
import org.pearl.mybatis.demo.pojo.qurey.UserQuery;

import java.util.HashMap;
import java.util.List;
import java.util.Map;

/**
 * Created by TD on 2021/6/5
 */
public interface UserMapper {
  /*  User selectOneById(Map<String,Object> map);*/

/*    User selectOneById(List<Long> ids);*/

    Map<String,Object> selectOneById(Long id);

    int insertUser( User user);

    int updateUserById(@Param("user")User user);

    int deleteUserById(Long id);

    List<User> getAllUser();



    UserInfoPo getUserInfoById(Long userId);


    Organization getOrgById(Long id);


    List<Role> getRolesByUserId(Long id);

    // 根据查询参数动态查询用户列表
    List<User> selectDynamicUserList(UserQuery userQuery);

    // 查询某些机构下的用户
    List<User> selectUserListByOrgId(Integer[] ids);


    // 根据Map查询用户列表
    List<User> selectUserListByMap(@Param("maps") Map<String,Object> maps);


    int insertBatch(List<User> userList);


    @Select("SELECT * FROM base_user WHERE userId = #{userId}")
    User getUser(@Param("userId") Long userId);


}
